﻿// -----------------------------------------------------------------------
// <copyright file="Fuel.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Ex03.GarageLogic
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    public enum eTypeOfFuel
    {
        Octan95 = 1,
        Octan96 = 2,
        Octan98 = 3,
        Soler = 4
    }

    public sealed class Fuel : EnergySource
    {
        private eTypeOfFuel m_TypeOfFuel;

        internal eTypeOfFuel FuelType
        {
            get { return this.m_TypeOfFuel; }
            set { this.m_TypeOfFuel = value; }
        }

        public void Refueling(eTypeOfFuel i_TypeFuel, float i_AmountToAdd)
        {
            if (i_TypeFuel != this.m_TypeOfFuel)
            {
                throw new ArgumentException("Wrong fuel type! This vehicle accepts " + this.m_TypeOfFuel.ToString());
            }

            if (this.m_CurrentEnergyLevel + i_AmountToAdd > this.m_MaxEnergyLevel || i_AmountToAdd < 0)
            {
                throw new ValueOutOfRangeException(0, m_MaxEnergyLevel - CurrentEnergyLevel, "Amount of fuel to fill is not between limits");
            }

            this.m_CurrentEnergyLevel += i_AmountToAdd;
        }
    }
}
